package demo.pkg;

/**
 * 代理类
 * @author ZhouWeiBo
 * @create 2022/6/7
 */
public class Proxy extends EntityInfo{
    private Entity entity;

    public Proxy() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        this.entity = (Entity) this.getClass().getClassLoader().loadClass("demo.pkg.Entity").newInstance();
    }

    public void saySomethingMore() {
        entity.saySomething();
    }

    @Override
    public void saySomething() {
        entity.saySomething();
    }
}
